<template>
	<view class="convert">
		<view class="convert-list">
			<view class="convert-list-view" v-for="(item,index) in list">
				<view class="convert-list-view-title">
					<image src="../../static/huiyijilu.png"></image>
					<text>{{item.exchange.name}}</text>
				</view>
				<view class="convert-list-view-view">
					<view class="convert-list-view-view-view">
						<view class="convert-list-view-view-view-1">消耗积分</view>
						<view class="convert-list-view-view-view-2">{{item.integral}}</view>
					</view>
					<view class="convert-list-view-view-view">
						<view class="convert-list-view-view-view-1">状&nbsp; &nbsp; &nbsp; 态</view>
						<view class="convert-list-view-view-view-2">
							<view v-if="item.status == 0" class="daihuihuan">待兑换</view>
							<view v-if="item.status == 1" class="yihuihuan">已兑换</view>
							<view v-if="item.status == 2" class="duihuanshibai">兑换失败</view>
						</view>
						
					</view>
					<view class="convert-list-view-view-view">
						<view class="convert-list-view-view-view-1">兑换时间</view>
						<view class="convert-list-view-view-view-2">{{item.createtime_text}}</view>
						
					</view>
					
					<view class="convert-list-view-view-view">
						<view class="convert-list-view-view-view-1">核销时间</view>
						<view class="convert-list-view-view-view-2">{{item.conversiontime_text}}</view>
						
					</view>
				</view>
				
				<view class="convert-list-view-buttom" v-if="item.status == 0" @click="maClick(item.qrcode)">核销码</view>
				<view class="convert-list-view-buttom huise" v-if="item.status > 0" >核销码</view>
			</view>
			
			
		</view>
		
		
		<view class="bagtanchuan" @click="bagClick()" v-if="hide==1"></view>
		
		<view class="bodytanchaun"  v-if="hide==1">
			<image :src="qrcode"></image>
			<view>到店扫一扫核销码</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: [],
				list : [],
				hide : 0,
				qrcode : ''
			}
		},
		onLoad() {
			this.getall();
		},
		methods:{
			maClick(e){
				this.hide = 1;
				this.qrcode  = e;
				console.log(e);
			},
			bagClick(){
				this.hide = 0;
			},
			getall(){
				let that  =this;
				that.$api.getexchangerecordall({}).then(res=>{
					if(res.code == 1){
						that.list = res.data.list;
					}
				})
			}
		}
	}
</script>

<style lang="less">
	.convert {
		background-color: #f8f8f8;
		height: 100%;
		.convert-list {
			width: 710rpx;
			margin: auto;
			padding-top: 40rpx;
			color: #333;
			.convert-list-view {
				background-color: #fff;
				padding: 10rpx;
				font-size: 36rpx;
				border-radius: 20rpx;
				margin-bottom: 30rpx;
				.convert-list-view-title {
					
					padding-bottom: 20rpx;
					padding-top: 20rpx;
					font-size: 36rpx;
					image {
						width: 70rpx;
						height: 70rpx;
					}
					text {
						padding-left: 10rpx;
						position: relative;
						top: -22rpx;
						font-weight: bold;
					}
				}
				.convert-list-view-view {
					padding-top: 20rpx;
					padding-bottom: 20rpx;
					width: 640rpx;
					margin: auto;
					border-top: 2rpx  dashed #e8e8e8 ;
					border-bottom : 2rpx  solid #e8e8e8 ;
					padding-left: 56rpx;
				
					.convert-list-view-view-view {
						line-height: 80rpx;
						display: flex;
						font-size: 34rpx;
						.convert-list-view-view-view-1 {
							font-weight: bold;
						}
						.convert-list-view-view-view-2 {
							padding-left: 20rpx;
							color: #a8a7a7;
						}
					}
				}
				.convert-list-view-buttom {
					width: 240rpx;
					border: 2rpx solid #e8e8e8;
					line-height: 80rpx;
					text-align: center;
					border-radius: 50rpx;
					margin-left: 440rpx;
					margin-top: 20rpx;
					margin-bottom: 20rpx;
				}
			}
		}
	}
	
	.daihuihuan {
		background: #ffb100;
		height: 60rpx;
		line-height: 60rpx;
		padding-left: 8rpx;
		padding-right: 8rpx;
		color: #fff;
		border-radius: 8rpx;
		margin-top: 12rpx;
	}
	.yihuihuan {
		background: #00adff;
		height: 60rpx;
		line-height: 60rpx;
		padding-left: 8rpx;
		padding-right: 8rpx;
		color: #fff;
		border-radius: 8rpx;
		margin-top: 12rpx;
	}
	.duihuanshibai {
		background: #ff5e00;
		height: 60rpx;
		line-height: 60rpx;
		padding-left: 8rpx;
		padding-right: 8rpx;
		color: #fff;
		border-radius: 8rpx;
		margin-top: 12rpx;
	}
	.huise {
		background: #e8e8e8;
		    color: #c1c1c1;
	}
</style>